/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.railway.app;

import java.awt.CardLayout;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 *
 * @author Kenny
 */
public class TicketForm extends javax.swing.JPanel {

    private CardLayout cl;

    /**
     * Creates new form ScheduleForm
     */
    public TicketForm() {
        initComponents();
        cl = (CardLayout) jpTaskContent.getLayout();
        jpTaskContent.add(new JPanel(), "null");
        jpTaskContent.add(new TicketPurchasePanel(), "purchase");
        jpTaskContent.add(new TicketChangePanel(), "change");
        jpTaskContent.add(new TicketCancelPanel(), "cancel");
        //jpTaskContent.add(new SeatPanel(),"seat");
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    public static void main(String args[]) {
        JFrame frame = new JFrame();
        frame.add(new TicketForm());

        frame.setVisible(true);
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jbtPurchase = new javax.swing.JButton();
        jbtChange = new javax.swing.JButton();
        jbtCancel = new javax.swing.JButton();
        jpTaskContent = new javax.swing.JPanel();

        setBackground(new java.awt.Color(236, 240, 241));
        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Walk in Ticketing", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI Emoji", 0, 12))); // NOI18N
        setPreferredSize(new java.awt.Dimension(890, 539));
        setLayout(null);

        jbtPurchase.setBackground(new java.awt.Color(52, 152, 219));
        jbtPurchase.setFont(new java.awt.Font("Segoe UI Emoji", 0, 14)); // NOI18N
        jbtPurchase.setForeground(new java.awt.Color(255, 255, 255));
        jbtPurchase.setText("Purchase");
        jbtPurchase.setFocusPainted(false);
        jbtPurchase.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtPurchaseActionPerformed(evt);
            }
        });
        add(jbtPurchase);
        jbtPurchase.setBounds(10, 20, 150, 50);

        jbtChange.setBackground(new java.awt.Color(52, 152, 219));
        jbtChange.setFont(new java.awt.Font("Segoe UI Emoji", 0, 14)); // NOI18N
        jbtChange.setForeground(new java.awt.Color(255, 255, 255));
        jbtChange.setText("Change");
        jbtChange.setFocusPainted(false);
        jbtChange.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtChangeActionPerformed(evt);
            }
        });
        add(jbtChange);
        jbtChange.setBounds(190, 20, 150, 50);

        jbtCancel.setBackground(new java.awt.Color(52, 152, 219));
        jbtCancel.setFont(new java.awt.Font("Segoe UI Emoji", 0, 14)); // NOI18N
        jbtCancel.setForeground(new java.awt.Color(255, 255, 255));
        jbtCancel.setText("Cancel");
        jbtCancel.setFocusPainted(false);
        jbtCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtCancelActionPerformed(evt);
            }
        });
        add(jbtCancel);
        jbtCancel.setBounds(370, 20, 150, 50);

        jpTaskContent.setLayout(new java.awt.CardLayout());
        add(jpTaskContent);
        jpTaskContent.setBounds(10, 70, 870, 460);

        getAccessibleContext().setAccessibleName("Admin and staff maintenance\n");
    }// </editor-fold>//GEN-END:initComponents

    private void jbtPurchaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtPurchaseActionPerformed
        jbtPurchase.setBackground(new Color(41, 128, 185));
        jbtChange.setBackground(new Color(52, 152, 219));
        jbtCancel.setBackground(new Color(52, 152, 219));
        cl.show(jpTaskContent, "purchase");
    }//GEN-LAST:event_jbtPurchaseActionPerformed

    private void jbtChangeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtChangeActionPerformed
        jbtPurchase.setBackground(new Color(52, 152, 219));
        jbtChange.setBackground(new Color(41, 128, 185));
        jbtCancel.setBackground(new Color(52, 152, 219));
        cl.show(jpTaskContent, "change");
    }//GEN-LAST:event_jbtChangeActionPerformed

    private void jbtCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtCancelActionPerformed
        jbtPurchase.setBackground(new Color(52, 152, 219));
        jbtChange.setBackground(new Color(52, 152, 219));
        jbtCancel.setBackground(new Color(41, 128, 185));
        cl.show(jpTaskContent, "cancel");
    }//GEN-LAST:event_jbtCancelActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jbtCancel;
    private javax.swing.JButton jbtChange;
    private javax.swing.JButton jbtPurchase;
    private javax.swing.JPanel jpTaskContent;
    // End of variables declaration//GEN-END:variables
}
